<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>发布博客</title>

<!-- Bootstrap -->
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- 富文本编辑插件 -->
<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.css" rel="stylesheet">
<!--  <link href="libs/summernote/summernote.css" rel="stylesheet"> -->
<link rel="stylesheet" type="text/css" href="/css/cms.css" />

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<style type="text/css">
</style>
</head>
<body>
	<jsp:include page="/WEB-INF/inc/top.jsp"></jsp:include>

	<!-- 横幅 -->
	<div class="container">
		<div class="row">
			<div class="col-md-12 my_banner"></div>
		</div>
	</div>
	<br />
	<!-- 主体内容区 -->
	<div class="container">
		<div class="row">
			<div class="col-md-3">
				<jsp:include page="/WEB-INF/inc/my_left.jsp"><jsp:param
						value="blog" name="module" /></jsp:include>
			</div>
			<div class="col-md-9">
				<div class="panel panel-default">
					<div class="panel-body">
						<h1>发布投票</h1>
						<hr />
						<div class="card">
							<div class="card-body">
								<form action="/article/vote/edit" method="post">
								<input type="hidden" name="id" value="${id }" />
									<p class="red">${message }</p>
									
				    	<p>
				    		<input name="title" class="form-control col-md-8" value='<c:if test="${id != null }">${title }</c:if>'
											placeholder="投票标题" />
				    	</p>
				    	<br/>
				    	<br/>
				    	<p>
				    		<button id="appendVoteOption" type="button" class="btn btn-success">添加投票项</button>
				    	</p>
				    	<p>
				    	<div id="voteOptionBox">
				    	<c:forEach items="${voteOptionVos }" var="option"> 
				    	  <div id="voteOption" class="form-group form-check">
							<input type="text" name="options" value="${option.value }" class="form-control col-md-8" />
						  </div>
						 </c:forEach>
				    	</div>
				    	</p>
				    	<p>
				    		<button type="submit" class="btn btn-info btn-block">保存</button> 
				    	</p>
				    	
				    	</form>
				    	</div>
				    	</div>
				  </div>
				</div>
				
			</div>
		</div>
	</div>
	
	<jsp:include page="/WEB-INF/inc/footer.jsp" />
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<!-- 富文本编辑插件的js库 -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.9/summernote.js"></script>	
<!-- 	 <script type="text/javascript" src="libs/summernote/summernote.js"></script> -->
	<script type="text/javascript">
		$(document).ready(
						function() {
							$("#content").summernote({
								placeholder : '博客内容',
								height : 300
							});
							$("#deleteCover").click(function(){
								$(this).parent().empty();
								$("input[name=isDelCover]").val("1");
							});
							// 添加投票选项按钮响应
							$("#appendVoteOption").click(function(){
								$("#voteOptionBox").append('<div id="voteOption" class="form-group form-check">'+
										'<input type="text" name="options" class="form-control col-md-8" placeholder="新选项"/>'
											  + '</div><br/>');
							})
						});
	</script>
  </body>
</html>